package com.sgzn.sgpay.service.tcp.model;

import com.sgzn.sgpay.service.tcp.SgTcpProtocolHead;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * Created by xxjs-gd-llf
 * DATETIME:2018/4/11 23:37
 * Description: 服务器应答注册码
 */
@Setter
@Getter
public class TcpLoginResponse {

    private String beginCode;

    private  String commandCode;

    @NotBlank
    private String deviceId;

    @NotBlank
    private String randomRegisterCode;

    @NotBlank
    @Length(max = 2)
  private   String checkSumCode;

    private String endCode;

    @Override
    public String toString(){
        //根据协议规范重载toString方法
        return  beginCode+ SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                commandCode+ SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                deviceId+ SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                randomRegisterCode + SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                checkSumCode+ SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                endCode;
    }

}
